package edu.sctu.practice.class01.wangfuxin.day20151014homework.assign02;


/**
 * Created by 鑫爷您慢点 on 2015/10/14.
 */
public class Circle {
    private double radius;
    private String circleName;
    public static int numOfObjects = 0;

    public Circle(float radius,String circleName){
        this.radius = radius;
        this.circleName = circleName;
        numOfObjects = numOfObjects+1;
    }

    public static void printCircle(Circle c){
        double area;
        double perimeter;
        area = (float) (Math.PI * c.getRadius()*c.getRadius());
        perimeter = 2*c.getRadius()* Math.PI;
        System.out.println(c.getCircleName()+"的半径为："+c.getRadius());
        System.out.println(c.getCircleName()+"的周长为："+perimeter);
        System.out.println(c.getCircleName()+"的面积为："+area+"\n");
    }

    public String getCircleName() {
        return circleName;
    }


    public double getRadius() {
        return radius;
    }

    public void setRadius(float radius) {
        this.radius = radius;

    }
    public static void main(String[] args) {
        printCircle(new Circle(4,"1号圆"));
        printCircle(new Circle(3,"2号圆"));
        printCircle(new Circle(5,"3号圆"));
        System.out.println("共创建了"+numOfObjects+"个"+"圆");
    }
}
